home *** CD-ROM | disk | FTP | other *** search
- Path: doc.ic.ac.uk!not-for-mail
- From: mdf@doc.ic.ac.uk (Martin Frost)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Plugs Ins
- Date: 18 Mar 1996 12:15:59 -0000
- Organization: Dept. of Computing, Imperial College, University of London, UK.
- Distribution: world
- Message-ID: <4ijk5v$31n@oak24.doc.ic.ac.uk>
- References: <Pine.SOL.3.91.960307160455.27918A@sirius>
- Reply-To: mdf@doc.ic.ac.uk (Martin Frost)
- NNTP-Posting-Host: oak24.doc.ic.ac.uk
- X-Newsreader: mxrn 6.18-23
-
-
- In article <Pine.SOL.3.91.960307160455.27918A@sirius>, Simon Clarke <cgs1co@sirius> writes:
-
- >I am writing a program, and would like to use Plugin code. How do you
- >load an executable Amiga file, and what, point the program counter at
- >it? (I am writing in assembler) Someone said something about LoadSeg()
-
- ; d1 is pointer to filename for plugin
-
- movea.l DOSBase,a6
- LIB LoadSeg
- move.l d0,Module
- beq error ; no file
- lsl.l #2,d0
- movea.l d0,a0
- [set up registers/args for plugin module]
- jsr 4(a0) ; this calls the first instruction in the file
-
- to unload the module, use
-
- movea.l DOSBase,a6
- move.l Module,d1
- LIB UnLoadSeg
-
- I recommend also passing a magic number to the module so it won't crash.
-
- If you want a number of routines in the module, use this:
-
- LIB LoadSeg
- move.l d0,Module
- beq error ; no file
- lsl.l #2,d0
- movea.l d0,a0
- cmp.l #MagicNumber,8(a0)
- bne error ; not a plugin
- [set up d0 as index into jump table, and set up args]
- jsr 12(a0,d0.w)
-
- and start your plugin module with:
-
- moveq #-1,d0
- rts
- dc.l MagicNumber
- [jump table starts here]
-
- Martin
-
-
- dc.l MagicNumber
-